Imports System.IO
Imports System.Drawing
Imports MetodosComuns
Imports System.Drawing.Imaging
Imports EnhancedFileUpload

Partial Class showImageFromVideo
  Inherits System.Web.UI.Page

  Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim vuVideo As VideoUpload = Session("vuVideo")
    Dim strTempo As String = Request.QueryString("time")
    If vuVideo IsNot Nothing AndAlso strTempo IsNot Nothing AndAlso strTempo.Trim().Length > 0 Then
      vuVideo.ThumbWidth = THUMBNAIL_WIDTH
      vuVideo.ThumbHeight = THUMBNAIL_HEIGHT
      vuVideo.ThumbTime = Integer.Parse(strTempo)
      vuVideo.ThumbToSave = False
      Dim bmpImage As Bitmap = vuVideo.extractThumb()
      Response.ContentType = "image/jpeg"
      Response.AppendHeader("Pragma", "no-cache")
      Response.CacheControl = "Private"
      Response.Expires = 0
      Response.CacheControl = "no-cache"
      Response.Cache.SetNoStore()
      If bmpImage IsNot Nothing Then
        bmpImage.Save(Response.OutputStream, ImageFormat.Jpeg)
        bmpImage.Dispose()
      End If
      Response.End()
    End If
  End Sub

End Class
